<template>
	<div>
		<el-tabs v-model="tab" class="icon" @tab-click="cutTabs">
			<el-tab-pane label="el-icon" name="elIcon"><iconeL @getIconel="setIcon"></iconeL></el-tab-pane>
			<el-tab-pane label="icon-font" name="iconfont"><iconFont @geticonFont="setIcon"></iconFont></el-tab-pane>
		</el-tabs>
	</div>
</template>

<script>
import iconeL from './icon_el';
import iconFont from './icon_font';
export default {
	components: { iconeL, iconFont },
	data() {
		return {
			tab: 'elIcon',
			tabsStorage: ''
		};
	},
	methods: {
		setIcon(res) {
			res.type = this.tab;
			this.$emit('getIcon', res);
		},
		cutTabs(res) {
			uni.setStorage({
				key: this.tabsStorage,
				data: res.name
			});
		}
	},
	created() {
		this.tabsStorage = '__cutSta' + this.$route.path;
	},
	mounted() {
		this.tab = uni.getStorageSync(this.tabsStorage) || 'elIcon';
	}
};
</script>

<style>
.icon >>> .el-tabs__item {
	background-color: #fff;
}
</style>
